const db = require('../db');

module.exports = {
	// 连接数据库根据用户名和密码查询用户信息
	Login: async (userName, password) => {
		const sql = 'select * from users_tb where username = ? and password = ?';
		return await db.query(sql, [userName, password]);
	},
	// 连接数据库根据用户名查询用户信息
	FindUserName: async (userName) => {
		const sql = 'select * from users_tb where username = ?';
		return await db.query(sql, [userName]);
	},
	// 连接数据库插入用户信息
	Register: async (userName, password) => {
		const sql = 'insert into users_tb values(null,?,?,null)';
		return await db.query(sql, [userName, password]);
	},
};
